package my.com.epetrol.rapidkl.model;

import android.util.Log;

public class MapPoint implements Point {
	private float x1;
	private float y1;
	private float x2;
	private float y2;
	private String label;
	private int circleId;
	
	private MapPoint(float x1, float y1, float x2, float y2, String label, int circleId) {
		this.x1 = x1;
		this.x2 = x2;
		this.y1 = y1;
		this.y2 = y2;
		this.label = label;
		this.circleId = circleId;
	}
	
	public static Point createPoint(float x1, float y1, float x2, float y2, int imageId, String label) {
		return new MapPoint(x1, y1, x2, y2, label, imageId);
	}
	
	@Override
	public int getDrawableId() {
		return circleId;
	}

	@Override
	public String getLabel() {
		return label;
	}

	public float getX1() {
		return x1;
	}

	public void setX1(float x1) {
		this.x1 = x1;
	}

	public float getY1() {
		return y1;
	}

	public void setY1(float y1) {
		this.y1 = y1;
	}

	public float getX2() {
		return x2;
	}

	public void setX2(float x2) {
		this.x2 = x2;
	}

	public float getY2() {
		return y2;
	}

	public void setY2(float y2) {
		this.y2 = y2;
	}
	
	public boolean inBound(float x, float y, float width, float height) {
		Log.i("update", "x1 = (" + (x1/width) + "), y1 = (" + (y1/height) + "), x2 = (" + (x2/width) + ", " + (y2/height) + ")");
		return (x > (x1/width) && x < (x2/width)) && (y > (y1/height) && y < (y2/height));
	}
}
